import java.util.Scanner;

public class text {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int count = in.nextInt();
            int[] arr=new int[count];
            for (int i = 0; i < count; i++) {
                arr[i]= in.nextInt();
                if(arr[i]==1){
                    System.out.println("No");
                    continue;
                }
                int num=0;
                String prime="Yes"
                for (int j =2; j <arr[i] ; j++) {
                    if(arr[i]%j==0){
                        prime="No";
                        break;
                    }


                    }
                System.out.println(prime);
                }

            }

    }
    public static void main1(String[] args) {
        Scanner in=new Scanner(System.in);
        while(in.hasNextInt()){
            int a=in.nextInt();
            int b=in.nextInt();
            if(a==0&&b==0){
                break;
            }
            System.out.println(a+b);
        }
    }
}
